package com.dnjn.mes.biz.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dnjn.mes.biz.domain.MesAssembly;
import com.dnjn.mes.biz.domain.MesWorkpiece;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 组件|模块表 Mapper 接口
 * </p>
 *
 * @author Amber
 * @since 2023-07-26
 */
public interface MesAssemblyMapper extends BaseMapper<MesAssembly> {

    @ResultMap("BaseResultMap")
    @Select("select a.* from mes_equipment e left join mes_assembly a on a.equipment_id =e.equipment_id " +
            " where 1=1 and e.equipment_name =#{equipmentName} and a.assembly_name= #{assemblyName}")
    MesAssembly queryByCrumb(@Param("equipmentName") String equipmentName, @Param("assemblyName") String assemblyName);

    @Select("SELECT MAX(ordinal) FROM mes_assembly ")
    Integer getMaxOrdinal();
}
